package top.hudk.tank.collider;

import top.hudk.tank.model.GameObject;

import java.util.LinkedList;
import java.util.List;

/**
 * 作用：
 *
 * @author hudk
 * @date 2020/9/10 23:26
 */
public class CollisionChain implements Collider{


    private List<Collider> colliderLinked = new LinkedList<>();

    public CollisionChain(){
        colliderLinked.add(new BulletTankCollider());
        colliderLinked.add(new TankTankCollider());
    }

    @Override
    public boolean collision(GameObject o1, GameObject o2) {
        for(Collider collider : colliderLinked){
            if(!collider.collision(o1,o2)){
                return false;
            }
        }
        return true;
    }
}
